package com.iflytek.threadpool.manager.service.impl;

import com.iflytek.threadpool.manager.service.PrintService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @program: threadpooltest
 * @description:
 * @author: 陈亮
 * @create: 2022-02-22 21:06
 */
@Service
public class PrintServiceImpl implements PrintService {


    @Override
    @Async("checkExecutor")
    public void printMessage01() {
        // 直接写业务
        for (int i = 0; i < 10; i++) {
            System.out.println("printMessage01这是" + Thread.currentThread().getName() + "在" + i + "次打印");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    @Override
    @Async("checkExecutor")
    public void printMessage02() {
        // 直接写业务
        for (int i = 0; i < 10; i++) {
            System.out.println("printMessage02这是" + Thread.currentThread().getName() + "在" + i + "次打印");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

}
